# Seymore - Content Management on Rails
# 
# Copyright (c) 2006 - 2007 Thomas Mango
# 
# For license information, please visit:
# http://code.google.com/p/seymore/
# 
# File created by Thomas Mango [tsmango@gmail.com]

class ApplicationController < ActionController::Base
  def user_can?(action)
    return User.count == 0 || (session[:user] && session[:user].can?(action))
  end
  
  def no_access
    flash[:notice] = "You don't have permission to do that. Try logging in as someone who can."
    redirect_to :controller => "login"
  end
end